import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: dell
 * Date: 2023-12-07
 * Time: 9:31
 */
class LogIn {
    private static String userName = "admin";
    private static String password = "123456";

    public void loginInfo(String userName, String password) throws UserNameException, PasswordException {
        if (!this.userName.equals(userName)) {
            throw new UserNameException("用户名错误！");
        }
        if (!this.password.equals(password)) {
            throw new PasswordException("用户名错误！");
        }
        System.out.println("登陆成功");
    }
}
public class test {
    public static void main(String[] args) {
        try {
            LogIn logIn=new LogIn();
            logIn.loginInfo("admin", "123456");
        } catch (UserNameException e) {
            e.printStackTrace();
        } catch (PasswordException e) {
            e.printStackTrace();

        }
    }
}
//    public static void main1(String[] args) {
//        Scanner in=new Scanner(System.in);
//        String str="123456";
//        String str1=in.nextLine();
//        if (str.equals(str1)){
//            System.out.println("登录成功");
//        }else {
//            System.out.println("登录失败");
//        }
//    }